﻿<div class="wrapper border-bottom white-bg page-heading">
    <div class="col-lg-pull-12">
        <ol class="breadcrumb">
            <li class="active">品类设置</li>
        </ol>
    </div>
</div>
<div ng-controller="tokenShopCategoryController">
    <form class="form-horizontal row">
        <div class="form-group">
            <div class="col-sm-3">
                <label class="col-sm-5 control-label">名称</label>
                <div class="col-sm-7">
                    <input name="name" type="text" class="form-control input-sm" ng-model="query.name">
                </div>
            </div>
            <div class="col-sm-3">
                <label class="col-sm-3 control-label">时间</label>
                <div class="col-sm-9">
                    <div date class="input-group date">
                        <input class="form-control input-sm" ng-model="query.begin_time">
                        <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>

                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <label class="col-sm-1 control-label">至</label>
                <div class="col-sm-9">
                    <div date class="input-group date">
                        <input class="form-control input-sm" ng-model="query.end_time">
                        <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <label class="col-sm-4 control-label">状态</label>
                <div class="col-sm-8">
                    <div class="col-sm-12">
                        <select name="is_disable" class="form-control input-sm" ng-model="query.is_disable">
                            <option value="">请选择</option>
                            <option value="0">正常</option>
                            <option value="1">禁用</option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-4">
                <div class="col-sm-offset-4 col-sm-8">
                    <button class="btn btn-primary btn-sm" ng-click="search()"><i class="fa fa-search"></i> 查询</button>
                    <button class="btn btn-primary btn-sm" ui-sref="app.tokenShopCategory.detail({action:'add',depth:query.depth})"><i class="fa fa-plus"></i> 添加</button>
                </div>
            </div>
        </div>
    </form>
    <table class="table table-hover m-t-md">
        <thead>
            <tr style="background-color: #f7f7f9;">
                <th>序号</th>
                <th ng-if="query.depth == 2">一级品类名称</th>
                <th>{{query.depth == 1 ? '一级品类名称':'二级品类名称'}}</th>
                <th>类别</th>
                <!--<th>商品数量</th>-->
                <th>更新时间</th>
                <th>排序</th>
                <th>状态</th>
                <th width="150">操作</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="item in model.rows">
                <td>{{$index+1}}</td>
                <td ng-if="query.depth == 2" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{item.parent_name}}</td>
                <td style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{item.name}}</td>
                <!--<td></td>-->
                <td>{{item.type==0?"商城":"集市"}}</td>
                <td>{{item.update_time}}</td>
                <td>{{item.sort}}</td>
                <td style="{{item.is_disabled ? 'color:#d3d3d3':'color:#337ab7'}}">{{item.is_disabled?"禁用":"启用"}}</td>
                <td>
                    <a class="btn btn-primary btn-xs" ui-sref="app.tokenShopCategory.detail({action:'edit',id:item.id})"><i class="fa fa-cog"></i> 编辑</a>
                    <a class="btn btn-primary btn-xs" ng-click="remove(item)"><i class="fa fa-trash"></i> 删除</a>
                    <a ng-if="item.is_disabled" class="btn btn-primary btn-xs" ng-click="updateStatus(item.id,0)"><i class="fa fa-cog"></i>启用</a>
                    <a ng-if="!item.is_disabled" class="btn btn-primary btn-xs" ng-click="updateStatus(item.id,1)"><i class="fa fa-cog"></i>停用</a>
                </td>
            </tr>
        </tbody>
    </table>
    <div class="row">
        <div class="col-md-12">
            <uib-pagination total-items="model.total_result" items-per-page="model.size" ng-model="model.page" num-pages="model.total_pages"
                            ng-change="search_page(model.page)" class="pagination-sm" boundary-links="true" boundary-link-numbers="true" max-size="30"
                            previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></uib-pagination>
            <span class="pull-right" style="margin: 30px 0px 20px 0px">共{{model.total_result}} 当前：{{model.page}}/{{model.total_pages}}</span>
        </div>
    </div>
</div>